package com.ivan.dao;

import javax.jdo.PersistenceManager;

public abstract class AbstractDao {
	
	private PersistenceManager pm = null;

	/**
	 * Generate Persistent Manager and Transaction
	 */
	public void beforeDao(){
		this.pm = PMF.get().getPersistenceManager();
	}
	
	/**
	 * Sub Class to call and implement its own business logic. 
	 */
	//public abstract void action();
	
	/**
	 * Commit the transaction and release Persistent Manager
	 */
	public void afterDao(){
		try{
			//Nothing to do herer...
		} finally {
			pm.close();
		}
	}
	
}
